﻿using System;
using System.Collections.Generic;
using System.Web;

namespace Mines.Ajax.Test
{
    [Mines.Ajax.AjaxClass]
    public class GetFun
    {
        [Mines.Ajax.AjaxMethod]
        public int Sum(int[] arr)
        {
            int sum = 0;
            foreach (var item in arr)
            {
                sum += item;
            }
            return sum;
        }
        [Mines.Ajax.AjaxMethod(Mines.Ajax.SessionState.ReadAndWrite)]
        public string Welcome(string youname)
        {
            var oldname = System.Web.HttpContext.Current.Session["name"] as string;
            if (oldname != null)
                oldname = "上一位访问者是：" + oldname + "<br/>";
            System.Web.HttpContext.Current.Session["name"] = youname;
            return oldname + youname + "，您好！欢迎使用Mines.Ajax… 现在时间：" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        }
    }
}